﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Transport
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected int GetCartCount()
        {
            return ShoppingCart.Instance.Items.Count;
        }
        protected int GetDonHangCount()
        {
            try
            {
                ChiTietDatXeControl datxe = new ChiTietDatXeControl();
                int result = datxe.getListToCancel(Session["user_name"].ToString()).Count;
                return result;
            }
            catch (Exception)
            {
                return 0;
            }
        }
        protected string GetService()
        {
            string html = null;
            DichVuControl dv = new DichVuControl();
            List<dich_vu> list = dv.listAll();
            foreach(dich_vu dichVu in list)
            {
                html += "<li><a href=\"./HireCars.aspx?madichvu="+dichVu.id_dich_vu+"\">" + dichVu.ten_dich_vu + "</a></li>";
            }
            return html; 
        }
        protected string getHangXe()
        {
            string html = null;
            HangXeControl hang_xe = new HangXeControl();
            List<hang_xe> list = hang_xe.listAll();
            foreach (hang_xe item in list)
            {
                html += "<li><a href=\"./HireCars.aspx?hangxe=" + item.ma_hang_xe + "\">" + item.ten_hang_xe + "</a></li>";
            }
            return html; 
        }
    }
}
